home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / language / embedded / mcu / hc05iic.arc / IIC.LST < prev    next >
File List  |  1990-06-15  |  9KB  |  170 lines

  1. M6805 Portable Cross Assembler  0.05   MS-DOS/PC-DOS  Page 1
  2.  Fri Jun 15 18:40:20 1990 
  3. Command line: 
  4.  C:\DOS\PASM05.EXE -l iic.lst iic.s
  5. Options list: 
  6. ON  - b - Printing of macro definitions
  7. ON  - c - Printing of macro calls
  8. OFF - d - Placing of symbolic debugging information in COFF
  9. OFF - e - Printing of macro expansions
  10. ON  - f - Printing of conditional directives
  11. OFF - g - Printing of generated constants list
  12. OFF - q - Expanding and printing of structured syntax
  13. OFF - s - Printing of symbol table
  14. OFF - u - Printing of conditional unassembled source
  15. OFF - x - Printing of cross reference table
  16. OFF - m - Suppress printing of error messages
  17. ON  - w - Printing of warning messages
  18. OFF - v - Suppress printing of updated status
  19. OFF - y - Enabling of sgs extensions
  20. ON  - o - Create object code
  21. ON  -   - Formatting of source line listing 
  22. Create listing file - l - iic.lst 
  23.  
  24. Xdefs: 
  25.   NONE 
  26.  
  27. Xrefs: 
  28.   NONE 
  29.  
  30. Input file(s): iic.s (106 lines) c4c8reg.s (260 lines) 
  31.  
  32. Output file: iic.o  
  33. Listing file: iic.lst 
  34.  
  35. M6805 Portable Cross Assembler  0.05  iic.s  Page 2
  36.  Fri Jun 15 18:40:20 1990  
  37. Options - MD,MC,NOG,NOU,W,NOMEX,CL,FMT,O
  38.  
  39. LINE   S PC   OPCO OPERANDS S LABEL    MNEMO OPERANDS COMMENT
  40. 00001                                  opt   mul,cmos,lle=132
  41. 00002                         * Software for 68hc05 to control IIC peripherals using the SPI interface
  42. 00003                         * adapted from Naji Naufel's article in EDN, Feb 18 1988
  43. 00004                         * Port C Bits 0 and 1 are used to generate the start and stop bits required
  44. 00005                         
  45. 00006                                  opt   nol      
  46. 00007                                  include c4c8reg.s
  47. 00008                                  opt   l        
  48. 00009                         
  49. 00010                                  asct           
  50. 00011  A 0000      0000     A data     equ   PC0      IIC data line controlled by PC0
  51. 00012  A 0000      0001     A .data    equ   .PC0     
  52. 00013  A 0000      0001     A clk      equ   PC1      IIC clock line controlled by PC1
  53. 00014  A 0000      0002     A .clk     equ   .PC1     
  54. 00015  A 0000      0002     A iicport  equ   PORTC    
  55. 00016  A 0000      0006     A iicddr   equ   DDRC     
  56. 00017                         
  57. 00018  A 0000      0000     A waddr    equ   0        IIC write address
  58. 00019  A 0000      0001     A raddr    equ   1        IIC read address
  59. 00020                         
  60. 00021                         * init initializes the I/O port hardware
  61. 00022                         
  62. 00023  A 0050                          org   $50      RAM location - ACK flag
  63. 00024  A 0050      01       A ack      rmb   1        set bit 0 to value of ACK bit desired after byte
  64. 00025  A 0051      01       A control  rmb   1        RAM location to store control word to IIC device
  65. 00026  A 0052      04       A ram      rmb   4        ram buffer for read command
  66. 00027                         
  67. 00028  A 0100                          org   $100     start of ROM
  68. 00029  A 0100 a6   03       A init     lda   #.data+.clk set clock and data high
  69. 00030  A 0102 b7   02       A          sta   iicport  
  70. 00031  A 0104 b7   06       A          sta   iicddr   both bits output
  71. 00032  A 0106 3f   0a       A          clr   SPCR     make sure SPI is didsabled to start
  72. 00033  A 0108 81                       rts            done
  73. 00034                         
  74. 00035                         * w_start transfers a byte from the HC05 SPI to the IIC peripheral
  75. 00036                         * Including a start bit.  nostart sends the byte with no start bit
  76. 00037                         * On entry the data is in the accumulator
  77. 00038                         
  78. 00039  A 0109 11   02       A w_start  bclr  data,iicport set data line low - start bit
  79. 00040  A 010b 13   02       A          bclr  clk,iicport drive clock low
  80. 00041  A 010d ae   50       A nostart  ldx   #.SPE+.MSTR enable spi
  81. 00042  A 010f bf   0a       A          stx   SPCR     
  82. 00043  A 0111 10   02       A          bset  data,iicport let data line go high
  83. 00044  A 0113 b7   0c       A          sta   SPDR     send the data
  84. 00045  A 0115 0f   0bfd  0115 wait     brclr SPIF,SPSR,wait poll while data shifted out
  85. 00046                         *                               set SPIE bit for interrupt-driven transfer
  86. 00047  A 0118 b6   0a       A          lda   SPCR     disable SPI
  87. 00048  A 011a a4   bf       A          and   #.SPE!X$ff
  88. 00049  A 011c b7   0a       A          sta   SPCR     
  89. 00050  A 011e 00   5007  0128          brset 0,ack,hiack test value of ack bit desired
  90. 00051  A 0121 11   02       A          bclr  data,iicport ack must be low - clear data line
  91. 00052  A 0123 ad   03    0128          bsr   hiack    generate clock pulse
  92.  
  93. M6805 Portable Cross Assembler  0.05  iic.s  Page 3
  94.  Fri Jun 15 18:40:20 1990  
  95. Options - MD,MC,NOG,NOU,W,NOMEX,CL,FMT,O
  96.  
  97. LINE   S PC   OPCO OPERANDS S LABEL    MNEMO OPERANDS COMMENT
  98. 00053  A 0125 10   02       A          bset  data,iicport let data go high again
  99. 00054  A 0127 81                       rts            
  100. 00055                         
  101. 00056  A 0128 12   02       A hiack    bset  clk,iicport pulse clock high, then low
  102. 00057  A 012a 21   fc    0128          brn   hiack    delay - 3 'E' clocks
  103. 00058  A 012c 13   02       A          bclr  clk,iicport
  104. 00059  A 012e 81                       rts            
  105. 00060                         
  106. 00061                         * This subroutine creates a stop condition
  107. 00062                         
  108. 00063  A 012f 11   02       A stop     bclr  data,iicport strobe data low
  109. 00064  A 0131 12   02       A          bset  clk,iicport positive edge on clock line
  110. 00065  A 0133 10   02       A          bset  data,iicport put data back to idle state
  111. 00066  A 0135 81                       rts            
  112. 00067                         
  113. 00068                         * This subroutine sends an address byte, followed by a control byte in CONTROL
  114. 00069                         
  115. 00070  A 0136 a6   00       A addrcnt  lda   #waddr   load address value
  116. 00071  A 0138 ad   cf    0109          bsr   w_start  send with start bit
  117. 00072  A 013a b6   51       A          lda   control  get desired control value
  118. 00073  A 013c ad   cf    010d          bsr   nostart  send without start bit
  119. 00074  A 013e 81                       rts            done
  120. 00075                         
  121. 00076                         * This subroutine reads four bytes from the peripheral
  122. 00077                         
  123. 00078  A 013f 3f   51       A read     clr   control  control = 0
  124. 00079  A 0141 10   50       A          bset  0,ack    ack bit should be 1
  125. 00080  A 0143 ad   f1    0136          bsr   addrcnt  send address followed by control
  126. 00081  A 0145 ad   e8    012f          bsr   stop     send stop bit
  127. 00082  A 0147 a6   01       A          lda   #raddr   now send read address
  128. 00083  A 0149 ad   be    0109          bsr   w_start  
  129. 00084  A 014b 11   50       A          bclr  0,ack    ack bit is 1
  130. 00085  A 014d a6   ff       A          lda   #$ff     read 4 bytes - must send ones during process
  131. 00086  A 014f ad   bc    010d          bsr   nostart  
  132. 00087  A 0151 b6   0c       A          lda   SPDR     get received data
  133. 00088  A 0153 b7   54       A          sta   ram+2    save in RAM
  134. 00089  A 0155 a6   ff       A          lda   #$ff     read 4 bytes - must send ones during process
  135. 00090  A 0157 ad   b4    010d          bsr   nostart  
  136. 00091  A 0159 b6   0c       A          lda   SPDR     get received data
  137. 00092  A 015b b7   55       A          sta   ram+3    save in RAM
  138. 00093  A 015d a6   ff       A          lda   #$ff     read 4 bytes - must send ones during process
  139. 00094  A 015f ad   ac    010d          bsr   nostart  
  140. 00095  A 0161 b6   0c       A          lda   SPDR     get received data
  141. 00096  A 0163 b7   53       A          sta   ram+1    save in RAM
  142. 00097  A 0165 10   50       A          bset  0,ack    last byte has ack bit set to 1
  143. 00098  A 0167 a6   ff       A          lda   #$ff     read 4 bytes - must send ones during process
  144. 00099  A 0169 ad   a2    010d          bsr   nostart  
  145. 00100  A 016b ad   c2    012f          bsr   stop     send stop bit
  146. 00101  A 016d b6   0c       A          lda   SPDR     get received data
  147. 00102  A 016f b7   52       A          sta   ram      save in RAM
  148. 00103  A 0171 81                       rts            done
  149. 00104                         
  150.  
  151. M6805 Portable Cross Assembler  0.05  iic.s  Page 4
  152.  Fri Jun 15 18:40:20 1990  
  153. Options - MD,MC,NOG,NOU,W,NOMEX,CL,FMT,O
  154.  
  155. LINE   S PC   OPCO OPERANDS S LABEL    MNEMO OPERANDS COMMENT
  156. 00105                                  end            
  157. 00106                         
  158.  
  159.  
  160.  
  161. Total number of errors: 0 
  162. Total number of warnings: 0 
  163. Total number of lines: 366 
  164.  
  165.  
  166. Number of bytes in section ASCT: 120 
  167.  
  168. Number of bytes in program: 120
  169.  
  170.